package com.emar.adx.yiqifa.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Locale;

/**
 * Created by xiaoliang on 2015/8/24 10:20.
 */
@Controller
@RequestMapping(value = "/https")
public class HttpsController {

    private static final Logger logger = LoggerFactory.getLogger(HttpsController.class);

    public HttpsController() {
        logger.debug("testx.......");
    }

    @RequestMapping(value = "/request")
    @ResponseBody
    public String httpsRequest(Locale locale, Model model,HttpServletRequest request){

        String prototacl = request.getProtocol();
        logger.debug("prototacl: "+prototacl);

        String host = request.getRemoteHost();
        logger.debug("host: " + host);

        String uri = request.getRequestURI();
        logger.debug("uri: "+uri);

        StringBuffer sb = request.getRequestURL();
        logger.debug("url: "+sb.toString());

        String ip = request.getRemoteAddr();
        logger.debug("remote ip :" + ip);

        String p = request.getHeader("X-Real-Protocol");
        logger.debug("X-Real-Protocol : "+p);

        return "ok";
    }
}
